package com.xhu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xhu.pojo.Permission;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface PermissionMapper extends BaseMapper<Permission> {
    @Select("SELECT p.* FROM `permission` p " +
            "LEFT JOIN `role_permission_rel` rpr ON rpr.permission_id = p.permission_id " +
            "LEFT JOIN `role` r ON r.role_id = rpr.role_id " +
            "WHERE " +
            "r.role_name = #{roleName}")
    List<Permission> permissionList(String roleName);
}
